<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>#{msg.benvenutoLabel}#{gestioneCliente.nome}</title>
        <style>
            .ui-datatable thead th, .ui-datatable tbody td, .ui-datatable tfoot td {
                padding: 0px;
            }
        </style>
    </h:head>
    <h:body>
        <div class="container">
            <ui:include src="Header.xhtml"/>
            <div class="content">
                #{redirect.redirectCliente(gestioneCliente, "Login.jsf")}
                <p:growl autoUpdate="true"/>
                <h3><p:outputLabel value="#{msg.benvenutoLabel}"/><p:outputLabel value="#{gestioneCliente.nome}"/><p:outputLabel value=";"/></h3><br/>
                <h:form>
                    <h:outputLink value="http://localhost:8080/E-Market-war/ReimpostaPassword.jsf">
                        <f:param name="iac" value="#{gestioneCliente.id}"/>
                        <h:outputText value="#{msg.reimPasswordTitle}"/>
                    </h:outputLink>
                </h:form><br/>
                <h4><p:outputLabel value="#{msg.ordiniTitle}"/></h4>
                <h:form>
                    <p:dataTable value="#{gestioneCliente.ordiniCliente}" style="text-align: center;" emptyMessage="#{msg.ordiniEmpty}" var="o">
                        <p:column exportable="false">
                            <p:rowToggler/>
                        </p:column>
                        <p:column headerText="#{msg.idTable}">
                            <p:outputLabel value="#{o.id}"/>
                        </p:column>
                        <p:column headerText="#{msg.dataTable}">
                            <h:outputFormat value="#{o.dataOrdine}">
                                <f:converter converterId="dataConverter"/>
                            </h:outputFormat>
                        </p:column>
                        <p:column headerText="#{msg.totaleTable}">
                            <h:outputFormat value="#{o.totale}">
                                <f:convertNumber maxFractionDigits="2" minFractionDigits="2"/>
                            </h:outputFormat>
                        </p:column>
                        <p:column headerText="#{msg.statoTable}">
                            <p:outputLabel value="#{gestioneCliente.statoFormattato(o)}"/>
                        </p:column>
                        <p:column headerText="#{msg.negozioTable}">
                            <p:outputLabel value="#{o.negozio.nome}"/>
                        </p:column>
                        <p:column headerText="#{msg.ricevutaTable}">
                            <p:commandButton id="downloadLink" ajax="false" onclick="PrimeFaces.monitorDownload(start, stop);" icon="ui-icon-disk">
                                <p:fileDownload value="#{pdfCreator.getRicuvutaPDF(o)}"/>
                            </p:commandButton>
                        </p:column>
                        <p:rowExpansion styleClass="myClass">
                            <p:dataTable value="#{gestioneCliente.dettaglioOrdine(o)}" var="dp">
                                <p:column style="min-width: 200px; max-width: 200px;" headerText="#{msg.nomeTable}">
                                    <p:outputLabel value="#{dp.prodotto.nome}"/>
                                </p:column>
                                <p:column headerText="#{msg.prezzoTable}">
                                    <h:outputFormat value="#{gestioneCliente.prezzoProdotto(o, dp)}">
                                        <f:convertNumber maxFractionDigits="2" minFractionDigits="2"/>
                                    </h:outputFormat>
                                </p:column>
                                <p:column headerText="#{msg.quantitaTable}">
                                    <p:outputLabel value="#{dp.quantità}"/>
                                </p:column>
                            </p:dataTable>
                        </p:rowExpansion>
                    </p:dataTable>
                </h:form>
                <br/><h4><p:outputLabel value="#{msg.numeroOrdiniForm}"/></h4><br/>
                <p:barChart id="stacked" value="#{gestioneCliente.grafifoNegozi}" legendPosition="ne" style="height:300px" title="#{msg.numeroOrdiniLabel}" stacked="true"  barMargin="50" min="0" max="#{gestioneCliente.maxOrdini}"/>
            </div>
            <ui:include src="Footer.xhtml"/>
        </div>
    </h:body>
</html>

